<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      #box1 {
        border: solid;
        background: rgb(215, 220, 207);

        padding: 10px;
      }

      #box2 {
        border: solid;
        padding: 10px;
        background: rgb(220, 209, 207);
      }
    </style>
  </head>
  <body>
    <div id="box1">
      box1
      <div id="box2">box2</div>
    </div>

    <script>
      const box1 = document.getElementById("box1");
      const box2 = document.getElementById("box2");

      box2.onmouseleave = function (e) {
        console.log("box2 onmouseout 移出");
      };

      box1.onmouseleave = function (e) {
        console.log("box1 onmouseout 移出");
      };
    </script>
  </body>
</html>
